﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Catel.Data;

namespace LprConfiger.Models
{
    /// <summary>
    /// Camera Data object class which fully supports serialization, property changed notifications,
    /// backwards compatibility and error checking.
    /// </summary>
#if !SILVERLIGHT
    [Serializable]
#endif
    public class Camera : DataObjectBase<Camera>
    {
        #region Variables
        #endregion

        #region Constructor & destructor
        /// <summary>
        /// Initializes a new object from scratch.
        /// </summary>
        public Camera() { }

#if !SILVERLIGHT
        /// <summary>
        /// Initializes a new object based on <see cref="SerializationInfo"/>.
        /// </summary>
        /// <param name="info"><see cref="SerializationInfo"/> that contains the information.</param>
        /// <param name="context"><see cref="StreamingContext"/>.</param>
        protected Camera(SerializationInfo info, StreamingContext context)
            : base(info, context) { }
#endif
        #endregion

        #region Properties
        // TODO: Define your custom properties here using the dataprop code snippet
        /// <summary>
        /// 监控点Id.
        /// </summary>
        public string StationId
        {
            get { return GetValue<string>(StationIdProperty); }
            set { SetValue(StationIdProperty, value); }
        }

        /// <summary>
        /// Register the StationId property so it is known in the class.
        /// </summary>
        public static readonly PropertyData StationIdProperty = RegisterProperty("StationId", typeof(string), "");

        /// <summary>
        /// 监控点名称.
        /// </summary>
        public string StationName
        {
            get { return GetValue<string>(StationNameProperty); }
            set { SetValue(StationNameProperty, value); }
        }

        /// <summary>
        /// Register the StationName property so it is known in the class.
        /// </summary>
        public static readonly PropertyData StationNameProperty = RegisterProperty("StationName", typeof(string), "");


        /// <summary>
        /// 方向编号.
        /// </summary>
        public string DirectionId
        {
            get { return GetValue<string>(DirectionIdProperty); }
            set { SetValue(DirectionIdProperty, value); }
        }

        /// <summary>
        /// Register the DirectionId property so it is known in the class.
        /// </summary>
        public static readonly PropertyData DirectionIdProperty = RegisterProperty("DirectionId", typeof(string), "");

        /// <summary>
        /// 方向名称.
        /// </summary>
        public string DirectionName
        {
            get { return GetValue<string>(DirectionNameProperty); }
            set { SetValue(DirectionNameProperty, value); }
        }

        /// <summary>
        /// Register the DirectionName property so it is known in the class.
        /// </summary>
        public static readonly PropertyData DirectionNameProperty = RegisterProperty("DirectionName", typeof(string), "");

        /// <summary>
        /// 相机ip.
        /// </summary>
        public string CameraIp
        {
            get { return GetValue<string>(CameraIpProperty); }
            set { SetValue(CameraIpProperty, value); }
        }

        /// <summary>
        /// Register the CameraIp property so it is known in the class.
        /// </summary>
        public static readonly PropertyData CameraIpProperty = RegisterProperty("CameraIp", typeof(string), "");

        /// <summary>
        /// 相机Id.
        /// </summary>
        public int CameraId
        {
            get { return GetValue<int>(CameraIdProperty); }
            set { SetValue(CameraIdProperty, value); }
        }

        /// <summary>
        /// Register the CameraId property so it is known in the class.
        /// </summary>
        public static readonly PropertyData CameraIdProperty = RegisterProperty("CameraId", typeof(int), 0);

        /// <summary>
        /// 所覆盖的车道.
        /// </summary>
        public ObservableCollection<Lane> Lanes
        {
            get { return GetValue<ObservableCollection<Lane>>(LanesProperty); }
            set { SetValue(LanesProperty, value); }
        }

        /// <summary>
        /// Register the name property so it is known in the class.
        /// </summary>
        public static readonly PropertyData LanesProperty = RegisterProperty("Lanes", typeof(ObservableCollection<Lane>), new ObservableCollection<Lane>());

        #endregion

        #region Methods
        /// <summary>
        /// Validates the fields.
        /// </summary>
        protected override void ValidateFields()
        {
            // TODO: Implement any field validation of this object. Simply set any error by using the SetFieldError method
        }

        /// <summary>
        /// Validates the business rules.
        /// </summary>
        protected override void ValidateBusinessRules()
        {
            // TODO: Implement any business rules of this object. Simply set any error by using the SetBusinessRuleError method
        }
        #endregion
    }
}
